﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Contact.aspx.cs" Inherits="WebshopPizzaRio.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<h1>Contactpagina</h1>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PizzaRioConnectionString %>" 
        SelectCommand="SELECT text FROM contactpagina where contactpaginaid = 1">
    </asp:SqlDataSource>
<asp:LoginView ID="LoginView1" runat="server">

<AnonymousTemplate>
            <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">

        <LayoutTemplate>
            <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
        </LayoutTemplate>
        <ItemTemplate>
                <%#Eval("text") %>
        </ItemTemplate>
    </asp:ListView>

        </AnonymousTemplate>

        <LoggedInTemplate>
            <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1">

        <LayoutTemplate>
            <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
        </LayoutTemplate>
        <ItemTemplate>
                <%#Eval("text") %>
        </ItemTemplate>
    </asp:ListView>
        </LoggedInTemplate>


        <RoleGroups>

            <asp:RoleGroup Roles="Administrators">
                <ContentTemplate>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PizzaRioConnectionString %>" 
        DeleteCommand="DELETE FROM [contactpagina] WHERE [contactpaginaid] = @contactpaginaid" 
        InsertCommand="INSERT INTO [contactpagina] ([contactpaginaid], [text]) VALUES (@contactpaginaid, @text)" 
        SelectCommand="SELECT [contactpaginaid], [text] FROM [contactpagina]" 
        UpdateCommand="UPDATE [contactpagina] SET [text] = @text WHERE [contactpaginaid] = @contactpaginaid">
        <DeleteParameters>
            <asp:Parameter Name="contactpaginaid" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="contactpaginaid" Type="Int32" />
            <asp:Parameter Name="text" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="text" Type="String" />
            <asp:Parameter Name="contactpaginaid" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="contactpaginaid" 
        DataSourceID="SqlDataSource2">
        <EditItemTemplate>
            <asp:TextBox ID="textTextBox" runat="server" Text='<%# Bind("text") %>' TextMode="multiline" />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="False" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Annuleren" />
                <br /><br />

                <asp:CustomValidator ID="valFile" runat="server" 
            ErrorMessage="Geen bestand geüpload." 
            onservervalidate="valFile_ServerValidate" Display="Dynamic" ForeColor="Red" />
        <asp:CustomValidator ID="valFileType" runat="server" 
            ErrorMessage="Dit is geen afbeelding." 
            onservervalidate="valFileType_ServerValidate" Display="Dynamic" ForeColor="Red" />
        <asp:CustomValidator ID="valFileSize" runat="server" 
            ErrorMessage="Deze afbeelding is groter dan 10MB." 
            onservervalidate="valFileSize_ServerValidate" Display="Dynamic" ForeColor="Red" /><br />
            <p>Afbeelding toevoegen:</p>
                <asp:FileUpload ID="fileImage" runat="server" />
            
        <asp:Button ID="btnSubmit" runat="server" Text="Upload" 
            onclick="btnSubmit_Click" />
            <br /><br />
            <asp:Label ID="Label2" runat="server" Text="Kopieer uw code: " Visible="False"></asp:Label>
            <br />
            <asp:Label ID="Label1" runat="server" Text="Label" Visible="False" ForeColor="Red" ></asp:Label>

        </EditItemTemplate>
        <ItemTemplate>
            <asp:Label ID="textLabel" runat="server" Text='<%# Bind("text") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Bewerken" />
        </ItemTemplate>
    </asp:FormView>
                </ContentTemplate>
            </asp:RoleGroup>

        </RoleGroups>

    </asp:LoginView>

<br /><br /><hr /><br /><br />
<h1>Nieuwsbrief</h1>
<p>U kunt uzelf opgeven om de nieuwsbrief te ontvangen.</p>

    <table class="style1">
        <tr>
            <td>
Naam  
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </td>
            <td>


<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
            ControlToValidate="Textbox1"
            ErrorMessage="Voer een naam in"><font color="red">Vul uw naam in</font>
        </asp:RequiredFieldValidator>

           </td>
        </tr>
        <tr>
        <td>
Mail
            </td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            </td>
            <td>

        <asp:RegularExpressionValidator   
            ID="RegularExpressionValidator1"   
            runat="server"   
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"  
            ControlToValidate="TextBox2"  
            ErrorMessage="Voer een geldig email adres in!"><font color="red">Voer een geldig email adres in</font>  
            </asp:RegularExpressionValidator>


                <asp:Panel ID="Panel1" runat="server">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
            ControlToValidate="Textbox2"
             ErrorMessage="Voer een geldig email adres in"><font color="red">Voer een geldig email adres in</font> 
        </asp:RequiredFieldValidator>
                </asp:Panel>

            </td>
        </tr>
    </table>
<asp:Button ID="Button1" runat="server" Text="Schrijf mij in" onclick="Button1_Click" />
    <br />
    <br />
    <asp:Label ID="Label3" runat="server" Text="U staat ingeschreven" Visible="false"></asp:Label>
    <br /><br />
</asp:Content>